package com.sm.healthy.model

import androidx.lifecycle.viewModelScope
import com.sm.healthy.base.App
import com.sm.healthy.data.bean.FetalEntity
import com.sm.healthy.data.bean.TemperatureEntity
import com.sm.healthy.ext.gson
import kotlinx.coroutines.launch
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel
import me.hgj.jetpackmvvm.callback.databind.BooleanObservableField
import me.hgj.jetpackmvvm.callback.databind.StringObservableField
import me.hgj.jetpackmvvm.util.LogUtils

class TemperatureModel : BaseViewModel() {
    val isStart = BooleanObservableField(false)
    val tempStr = StringObservableField("---")

    val dao = App.database.temperatureDao()

    fun insert(entity: TemperatureEntity) {
        LogUtils.debugInfo("csw", "data = ${gson.toJson(entity)}")
        viewModelScope.launch {
            dao.insert(entity)
        }
    }

    fun clear() {
    }
}